package p2pcdnsim.network;

import desmoj.core.simulator.SimTime;

public class Packet {
	
	private static int PACKET_ID_GEN = 0;
	
	private static final int IP_HEADER_SIZE = 16;
	
	private NetworkAddress destination;
	private NetworkAddress source;
	private int id;
	private SimTime timeStamp;
	private PacketContent content;

	public Packet(NetworkAddress source, NetworkAddress destination, SimTime time) {
		this.source = source;
		this.destination = destination;
		this.id = Packet.PACKET_ID_GEN ++;
		this.timeStamp = time;
	}



	public NetworkAddress getSource() {
		return source;
	}

	public NetworkAddress getDestination() {
		return destination;
	}



	public int getId() {
		return id;
	}

	
	public long getSize() {
		//TODO: improve this
		return content.getSize()+IP_HEADER_SIZE;
	}

	public SimTime getTimeStamp() {
		return timeStamp;
	}



	public void setContent(PacketContent content) {
		this.content = content;
	}



	public PacketContent getContent() {
		return content;
	}
	
}
